package com.effective;

import java.util.Date;

public class FinalObjecty {
	private final String name;
	private final User user;
	
	public FinalObjecty(String name, User user) {
		super();
		this.name = name;
		this.user = user;
	}
	
	@Override
	public String toString() {
		return "FinalObjecty [name=" + name + ", user=" + user + "]";
	}

	public static void main(String[] args) throws Exception {
		User u = new User(new Date());
		FinalObjecty f = new FinalObjecty("1", u.clone());
		System.out.println(f);
		u.getDate().setTime(1L);
		System.out.println(f);
	}
}/**
* Output:
* FinalObjecty [name=1, user=User [date=Tue Nov 05 18:21:19 CST 2019]]
* FinalObjecty [name=1, user=User [date=Tue Nov 05 18:21:19 CST 2019]]
*/
